Init from nib, but alloc only [UIViewController]
Posted
by bobobobo
on Stack Overflow
See other posts from Stack Overflow
or by bobobobo
Published on 2010-04-28T02:29:03Z
Indexed on
2010/04/28
2:33 UTC
Read the original article
Hit count: 274
objective-c
|ass-biters
So I'm doing this in my code now:
UIViewController* ctrl =
[[UIViewController alloc] // i'm alloc'ing a UIViewController...
initWithNibName:@"TheNibName" // But this NIB has, within
// interface builder, a link to "UIViewControllerDERIVATIVE". So really,
// `ctrl` is a UIViewControllerDERIVATIVE instance, not just
// a UIViewController instance.
bundle:nil] ;
The reason I'm doing this is it makes a massive convenience in writing some code that pushes modal dialogs on.. since Objective-C doesn't support <template>.
My question is, is this ok?? Or will it bite me in the ass later?
© Stack Overflow or respective owner